<?php
	include "../public/commom/config.php";
	include "../public/commom/commom.php";
	
	if($_GET) {
		$store_id = $_GET["store_id"];
		
		$sql = "SELECT store.*, area.name aname FROM store LEFT JOIN user ON (store.user_id = user.id) LEFT JOIN area ON (user.area_id = area.id) WHERE store.id = '$store_id'";
		
		$result = mysqli_query($conn, $sql);
		
		while($row = mysqli_fetch_assoc($result)) {
			$logo = $row["logo"];
			$name = $row["name"];
			$aname = $row["aname"];
		}
	}
?>

<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimal-ui">
		<title>店铺</title>
		<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.5.0/css/all.css" integrity="sha384-B4dIYHKNBt8Bc12p+WXckhzcICo0wtJAoU8YZTY5qE0Id1GSseTk6S+L3BlXeVIU" crossorigin="anonymous">
		<link rel="stylesheet" type="text/css" href="public/css/index.css"/>
	</head>
	<body>
		<?php include "public/commom/header.php"; ?>
		
		<div id="store">
			<div class="store-info">
				<div class="logo">
					<img src="<?php echo $imgPath . $logo; ?>"/>
				</div>
				<div class="store-content">
					<h1><?php echo $name; ?></h1>
					<p>销量&nbsp;0</p>
					<span><?php echo $aname; ?></span>
				</div>
			</div>
			<div class="store-shop">
				<div class="title">
					<h1>商品</h1>
				</div>
				<?php
					$sql = "SELECT shop.*, area.name aname FROM shop LEFT JOIN area ON (shop.area_id = area.id) WHERE shop.store_id = '$store_id'";
			
					$result = mysqli_query($conn, $sql);
					
					while($row = mysqli_fetch_assoc($result)) {
						?>
	
							<div class='brand-shop'>
								<div class='brand-shop-left'>
									<a href="shopdetails.php?shop_id="><img src="<?php echo $imgPath .$row["img"]; ?>" width='100px'/></a>
								</div>
								<div class='brand-shop-right'>
									<div>
										<h6><?php echo $row["name"]; ?></h6>
										<p><b>￥<?php echo $row["price"]?></b>&nbsp;&nbsp;&nbsp;销量：<?php echo $row["sales"]; ?>&nbsp;&nbsp;&nbsp;<?php echo $row["aname"]; ?></p>
										<p>库存：<?php echo $row["inventory"]; ?></p>
										<p><?php echo $name; ?></p>
									</div>
								</div>
							</div>
						</div>
						
						<?php
					}
				?>
			</div>
		</div>
	</body>
</html>
